package zhihuilan.common.exception;

import lombok.Getter;
import zhihuilan.common.enums.Errors;

@Getter
public class BizException extends RuntimeException {
    private final int code;

    public BizException(Errors error) {
        super(error.getMsg());
        this.code = error.getCode();
    }

    public BizException(Errors error, String msg) {
        super(msg);
        this.code = error.getCode();
    }

    public BizException(Errors error, Throwable cause) {
        super(error.getMsg(), cause);
        this.code = error.getCode();
    }

    public BizException(Errors error, String msg, Throwable cause) {
        super(msg, cause);
        this.code = error.getCode();
    }
}
